home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / libs / x / xview / xview3.004 / xview3 / usr / openwin / include / pixrect / cg12_var.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-30  |  4.6 KB  |  150 lines

  1. /* @(#)cg12_var.h    1.10 of 9/19/90 SMI */
  2.  
  3. /* Copyright 1990 by Sun Microsystems, Inc. */
  4.  
  5. /* Sun Color Graphics board 12 (CG12) */
  6.  
  7. #ifndef cg12_var_DEFINED
  8. #define    cg12_var_DEFINED
  9.  
  10. #include <sys/types.h>
  11. #include <sys/ioctl.h>
  12. #ifndef SVR4
  13. #include <sun/fbio.h>
  14. #else
  15. #include <sys/fbio.h>
  16. #endif SVR4
  17. #include <pixrect/pixrect.h>
  18. #ifndef SVR4
  19. #include <sbusdev/cg12reg.h>
  20. #endif SVR4
  21. #include <pixrect/memvar.h>
  22. #ifndef SVR4
  23. #include <sunwindow/cms.h>        /* colormapseg */
  24. #else
  25. #include <sys/cms.h>
  26. #endif SVR4
  27.  
  28. #define    CG12_NFBS        6    /* number of frame buffers in a CG12 */
  29.  
  30. /* description of single CG12 frame buffer */
  31.  
  32. struct cg12fb
  33. {
  34.     short               group;        /* plane group implemented */
  35.     short               depth;        /* depth, bits */
  36.     struct mprp_data    mprp;        /* memory pixrect data */
  37. };
  38.  
  39. /*  CG12  Pixrect private data */
  40.  
  41. struct cg12_data
  42. {
  43.     /* first make it look like a gp device */
  44.  
  45.     struct cg2fb       *cgpr_va;    /* backward source compatible */
  46.     caddr_t             gp_shmem;    /* pointer to shared memory */
  47.     int                 cgpr_fd;    /* primary flag */
  48.     int                 cgpr_planes;    /* color bit plane mask reg */
  49.     struct pr_pos       cgpr_offset;    /* pixrect offset */
  50.     short               cg2_index;    /* cg2 board index */
  51.     char                minordev;    /* true minor dev to stuff into GP */
  52.     int                 gbufflag;    /* gbuffer flag */
  53.     int                 ioctl_fd;    /* the fd to talk to the driver with */
  54.     int                 ncmd;        /* length of cmdver array */
  55.     u_char             *cmdver;        /* version #'s for each command */
  56.     int                 flags;        /* misc options */
  57.     int                 linebytes;    /* bytes per line (pixel mode) */
  58.     int                 fbtype;        /* which cg is bound */
  59.  
  60.     /* then make it look like a memory device with multiple plane groups */
  61.  
  62.     struct mprp_data    mprp;        /* memory pixrect simulator */
  63.     int                 cg12_flags;    /* misc. flags */
  64.     int                 planes;        /* current group and mask */
  65.     int                 fd;        /* file descriptor */
  66.     short               active;        /* active fb no. */
  67.  
  68.     /* finally get some cg12 specific portions in */
  69.  
  70.     struct cg12_ctl_sp *ctl_sp;
  71.     struct cg12fb       fb[CG12_NFBS];    /* frame buffer info */
  72.     struct fb_wid_dbl_info    wid_dbl_info;    /* window id */
  73.     int            windowfd;
  74. };
  75.  
  76. /* cg12 specific constants */
  77.  
  78. /*
  79.    There are 256 pixels of dither data.  The framebuffer is being addressed
  80.    by an int ptr.  The framebuffer is in 4 bits/pixel mode.  Hence each 
  81.    int points to 8 contiguous pixels.  Hence the offset from the base of 
  82.    the framebuffer is  (num dith pixels + num solid pixels + num hollow
  83.    pixels)/8.   See below.
  84.  
  85.    note, if the size of any of these sections is changed in the cg12
  86.    microcode, then changes need to be propogated here too.  */
  87.  
  88. #define CG12_FB_SIZE   (CG12_WIDTH * CG12_HEIGHT)
  89.  
  90. /* amount to offset from beginning of offscreen memory for dither data */
  91. #define CG12_DITHER_SIZE       256
  92.  
  93. /* amount to offset from beginning of offscreen memory for solid pattern data */
  94. #define CG12_SOLID_PAT_SIZE    16
  95.  
  96. /* amount to offset from beginning of offscreen memory for hollow pattern data */
  97. #define CG12_HOLLOW_PAT_SIZE   16
  98.  
  99. #define CG12_OFFSCREEN_START ((CG12_FB_SIZE + CG12_DITHER_SIZE + \
  100.                    CG12_SOLID_PAT_SIZE + CG12_HOLLOW_PAT_SIZE) >> 3)
  101.  
  102. /* HACCESS value for 4 bits/pixel when loading offscreen VRAM */
  103.  
  104. #define CG12_OS_HACCESS 0x22
  105.  
  106. /* PLN_WR_MASK value for loading lower 4bits of each DPU offscreen VRAM */
  107.  
  108. #define CG12_OS_PLN_WR_MASK 0x000F0F0F
  109.  
  110. /*
  111. /* useful macros */
  112.  
  113. #define    cg12_d(pr)    ((struct cg12_data *) ((pr)->pr_data))
  114.  
  115. #define CG12_PR_TO_MEM(src, mem)                    \
  116.     if (src && src->pr_ops != &mem_ops)                    \
  117.     {                                    \
  118.     (void) cg12_set_state(src);                    \
  119.     mem.pr_ops      = &mem_ops;                    \
  120.     mem.pr_size     = src->pr_size;                    \
  121.     mem.pr_depth    = src->pr_depth;                \
  122.     mem.pr_data     = (char *) &cg12_d(src)->mprp;            \
  123.     src             = &mem;                        \
  124.     }
  125.  
  126. extern struct pixrectops cg12_ops;
  127.  
  128. int                 cg12_ioctl();
  129. int                 cg12_putcolormap();
  130. int                 cg12_putattributes();
  131. int                 cg12_rop();
  132.  
  133. #ifndef KERNEL
  134. extern int          gp1_rop();
  135.  
  136. int                 cg12_batchrop();
  137. int                 cg12_destroy();
  138. int                 cg12_get();
  139. int                 cg12_getattributes();
  140. int                 cg12_getcolormap();
  141. Pixrect            *cg12_make();
  142. int                 cg12_put();
  143. Pixrect            *cg12_region();
  144. int                 cg12_stencil();
  145. int                 cg12_vector();
  146.  
  147. #endif    /* !KERNEL */
  148.  
  149. #endif    /* cg12var_DEFINED */
  150.